package com.homily.com.test0;

import android.content.Intent;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

/**
 * 首页面
 */
public class MainActivity extends AppCompatActivity implements View.OnClickListener{
    protected EditText mname;
    protected EditText mpassword;
    @Override
    protected void onCreate( Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        findViewById(R.id.bt_denglu).setOnClickListener(this);
        mname=findViewById(R.id.et_name);
        mpassword=findViewById(R.id.et_password);

    }



    @Override
    public void onClick(View v) {
        String name=mname.getText().toString();
        String password=mpassword.getText().toString();
        if (name.equals("xpw")&&password.equals("123456")) {
            Intent intent = new Intent(this, SecondActivity.class);
            startActivity(intent);
            Toast.makeText(this,"登录成功",Toast.LENGTH_SHORT).show();
        }else{
            Toast.makeText(this,"用户名或密码错误，请重新输入",Toast.LENGTH_SHORT).show();
        }

    }
}
